package com.swz.dcrm.util;

import android.content.Context;
import android.graphics.Rect;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

public class HorizontalDecoration extends RecyclerView.ItemDecoration {
    private int left;
    private int right;
    public HorizontalDecoration(Context context,  int left, int right) {

        this.left=Tool.dip2px(context,left);
        this.right=Tool.dip2px(context,right);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view,
                               RecyclerView parent, RecyclerView.State state) {

        outRect.left = left;
        outRect.right = right;

        if (parent.getChildLayoutPosition(view) == 0&&left==0){
            outRect.left = Tool.dip2px(view.getContext(),15);
        }


    }


}
